package com.mybatis_demo.frame.session.factory;

import com.mybatis_demo.frame.session.SqlSession;
import com.mybatis_demo.frame.session.config.Configuration;
import com.mybatis_demo.frame.session.defaults.DefaultSqlSession;

import javax.sql.DataSource;

public class SqlSessionFactory {
    private Configuration configuration;

    public void setConfiguration(Configuration configuration) {
        this.configuration = configuration;
    }

    public Configuration getConfiguration() {
        return configuration;
    }

    public SqlSession openSession(){
        DefaultSqlSession defaultSqlSession = new DefaultSqlSession();
        defaultSqlSession.setConfiguration(configuration);
        return defaultSqlSession;
    }
}
